package com.taotao.portal.service.ipml;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.taotao.common.pojo.TaotaoResult;
import com.taotao.common.utils.HttpClientUtil;
import com.taotao.pojo.TbItemDesc;
import com.taotao.portal.service.IItemDescService;

/**
 * 商品描述
 * 
 * @author Administrator
 *
 */
@Service
public class ItemDescServiceIpml implements IItemDescService {
	@Value("${REST_BASE_URL}")
	private String REST_BASE_URL;

	@Value("${ITEM_DESC_URL}")
	private String ITEM_DESC_URL;

	@Override
	public String getItemDescByItemId(Long ItemId) {
		String doGet = HttpClientUtil.doGet(REST_BASE_URL + ITEM_DESC_URL
				+ ItemId);
		if (StringUtils.isNotBlank(doGet)) {
			TaotaoResult taotaoResult = TaotaoResult.formatToPojo(doGet,
					TbItemDesc.class);
			TbItemDesc itemDesc = (TbItemDesc) taotaoResult.getData();
			String result = itemDesc.getItemDesc();
			return result;
		}
		return "";

	}
}
